import java.util.ArrayList;
import java.util.List;

public class Solution {
    List<Integer> path;
    List<List<Integer>> ret;
    int n, k;
    public List<List<Integer>> combine(int _n, int _k) {
        n = _n;
        k = _k;
        path = new ArrayList<>();
        ret = new ArrayList<>();

        dfs(1);
        return ret;
    }
    public void dfs(int start){
        if(k == path.size()){
            ret.add(new ArrayList<>(path));
            return;
        }
        for (int i = start; i <= n; i++) {
            path.add(i);
            dfs(i+1);
            path.remove(path.size() - 1);
        }

    }
}
